package com.yuan.mqtt;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication
public class MqttApplication {
    /**
     * 处理使用混淆工具的加密造成的依赖注入失败问题
     * @return:
     * @sourceOrTime:
     * @author: cfy
     * @date: 2022/2/17 20:48
     * @version: 0.0.1
     */
    public static class CustomGenerator implements BeanNameGenerator {
        @Override
        public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
            return definition.getBeanClassName();
        }
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(MqttApplication.class)
                .beanNameGenerator(new CustomGenerator())
                .run(args);
    }

}
